<?php
if ($view->branches)
{
    ?>

    <h3>Sucursales </h3>
    <table class="table">
        <thead>
            <tr>
                <th>Nombre</th>
                <th>Direccion</th>
                <th>Punto de recoleci&oacute;n </th>
            </tr>
        </thead>

        <tbody>
            <?php
            foreach ($view->branches as $branches)
            {
                $addPoint = '<div class="btn-group"><button class="btn addPoint" id="' . $branches->getId() . '">Agregar punto de recoleccion</button></div>';
                ?>
                <tr>
                    <td><?php echo $branches->getName(); ?></td>
                    <td><?php echo $branches->getDirection(); ?></td>
                    <td><?php echo $branches->getPoint() ? $branches->getPoint()->getAddress() : $addPoint; ?></td>
                </tr>
                <?php
            }
            ?>
        </tbody>
    </table>
    <?php
}
else
{
    echo '<div class="alert">No se encontro informacion para este usuario</div>';
}
?>

    <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h3 id="myModalLabel">Modal header</h3>
        </div>
        <div class="modal-body">
        <?php if ($view->points):
                foreach ($view->points as $package): ?>
                    <input type="radio" name="points" class="pointOption" value="<?php echo $package->getId(); ?>"><?php echo $package->getName(); ?><br>
        <?php   endforeach; 
            else: ?>
                <div class="alert">No tiene ningun punto a asignar</div>
        <?php endif; ?>
        </div>
        <div class="modal-footer">
            <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
            <button class="btn btn-primary" id="saveChange">Save changes</button>
        </div>
    </div>